package com.douwong.student.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.douwong.student.R;
import com.douwong.student.model.DiscussSendData;

import java.util.List;

/**
 * @autor yichao
 * @time 2017/4/1410:06
 * @des 组成员
 */
public class MemberAdapter extends BaseAdapter {


    private Context mContext;
    private List<DiscussSendData.Member> mMember;

    public MemberAdapter(Context context, List<DiscussSendData.Member> member) {

        mContext = context;
        mMember = member;
    }

    @Override
    public int getCount() {
        return mMember.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @SuppressLint("ViewHolder")
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.member_item, null);
        TextView name = (TextView) convertView.findViewById(R.id.name);
        DiscussSendData.Member infor = mMember.get(position);
        if (infor != null) {
     /*       if (infor.Sex == 0) {// 男
                name.setBackgroundResource(R.mipmap.member_online);
            } else if (infor.Sex == 1) {// 女
                name.setBackgroundResource(R.mipmap.member_girl);
            }*/
            name.setBackgroundResource(R.mipmap.member_online);
            name.setText(infor.studentRemark);
        }
        return convertView;
    }
}
